package com.example.administrator.jinritoutiao.activity;

import android.content.Intent;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;

import com.example.administrator.jinritoutiao.R;
import com.example.administrator.jinritoutiao.utils.MyHttpUtil;

public class ChannelActivity extends BaseActivity implements View.OnClickListener {

    private final String CHANNEL_URL = "http://ic.snssdk.com/article/category/get/v2/";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_channel);
//        RecyclerView rv = (RecyclerView) findViewById(R.id.rv);
        ImageView iv = (ImageView) findViewById(R.id.iv_sj);
        iv.setOnClickListener(this);
        initData();

    }

    private void initData() {
        new AsyncTask<String, Void, String>() {
            @Override
            protected String doInBackground(String... params) {
                String json = MyHttpUtil.getinstionce().mGetJson(params[0]);

                return json;
            }
        }.execute(CHANNEL_URL);

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.iv_sj:
                Intent intent = new Intent(this,HomeActivity.class);
                startActivity(intent);
                overridePendingTransition(R.anim.down_in,R.anim.up_out);
                break;
        }
    }
}
